package cn.net.xyan.finereport.plugin.crack;

import javassist.*;

/**
 * Created by zarra on 16/12/9.
 */
public class ClassUtils {
    public static ClassPool defaultClassPool(){
        ClassPool cp =  ClassPool.getDefault();

        cp.appendSystemPath();

        try {
            cp.appendClassPath(new ClassClassPath(com.fr.base.ClassUtils.class));
        }catch (Throwable e){
            e.printStackTrace();
        }
        return cp;
    }

    public static CtClass ctClass(ClassPool pool,String className) throws NotFoundException {
        return pool.get(className);
    }

    public static CtMethod ctMethod(CtClass ctClass,String methodName) throws NotFoundException {
        return ctClass.getDeclaredMethod(methodName);
    }
}
